
 import { FieldType } from 'choerodon-ui/pro/lib/data-set/enum';

 const tableInlineDs = () => ({
  primaryKey: 'userid',
  name: 'user',
  queryUrl: '/_api/table/inline/dataset/user/queries',
  submitUrl: '/_api/table/inline/dataset/user/mutations',
  tlsUrl: '/_api/table/inline/dataset/user/languages',
  validateUrl: '/_api/table/inline/dataset/user/validate',
  autoQuery: true,
  pageSize: 5,
  cacheSelection: true,
  queryFields: [
    { name: 'name', type: FieldType.string, label: '姓名' },
    { name: 'age', type: FieldType.number, label: '年龄' },
    { name: 'code', lovDefineUrl: '/_api/table/inline/sys/lov/lov_define', type: FieldType.object, lovQueryUrl: '/_api/table/inline/common/lov/dataset/LOV_CODE', label: '代码描述', lovCode: 'LOV_CODE' },
    { name: 'sex', lookupUrl: '/_api/table/inline/common/code/HR.EMPLOYEE_GENDER', type: FieldType.string, label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
    { name: 'date.startDate', type: FieldType.date, label: '开始日期' },
    {
      name: 'sexMultiple',
      type: FieldType.string,
      label: '性别（多值）',
      lookupUrl: '/_api/table/inline/common/code/HR.EMPLOYEE_GENDER',
      lookupCode: 'HR.EMPLOYEE_GENDER',
      multiple: true,
    },
  ],
  fields: [
    {
      name: 'userid',
      type: FieldType.string,
      label: '编号',
      required: true,
      unique: true,
      help: '主键，区分用户',
    },
    { name: 'name', type: FieldType.intl, label: '姓名' },
    {
      name: 'age',
      type: FieldType.number,
      label: '年龄',
      unique: 'uniqueGroup',
      max: 100,
      step: 1,
      help: '用户年龄，可以排序',
    },
    {
      name: 'numberMultiple',
      type: FieldType.number,
      label: '数值多值',
      multiple: true,
      min: 10,
      max: 100,
      step: 0.5,
    },
    { name: 'code', lovDefineUrl: '/_api/table/inline/sys/lov/lov_define', lovQueryUrl: '/_api/table/inline/common/lov/dataset/LOV_CODE', type: FieldType.object, label: '代码描述', lovCode: 'LOV_CODE' },
    {
      name: 'code_code',
      bind: 'code.code',
      type: FieldType.string,
      label: '代码',
      maxLength: 11,
      required: true,
    },
    { name: 'code_description', bind: 'code.description', type: FieldType.string, label: '代码描述' },
    {
      name: 'code_select',
      type: FieldType.string,
      lovDefineUrl: '/_api/table/inline/sys/lov/lov_define',
      label: '代码描述(下拉)',
      lovCode: 'LOV_CODE',
      lovQueryUrl: '/_api/table/inline/common/lov/dataset/LOV_CODE',
      required: true,
    },
    {
      name: 'codeMultiple',
      type: FieldType.object,
      label: '代码描述（多值）',
      lovDefineUrl: '/_api/table/inline/sys/lov/lov_define',
      lovQueryUrl: '/_api/table/inline/common/lov/dataset/LOV_CODE',
      lovCode: 'LOV_CODE',
      multiple: true,
      required: true,
    },
    {
      name: 'codeMultiple_code',
      bind: 'codeMultiple.code',
      type: FieldType.string,
      label: '代码（多值）',
      multiple: true,
    },
    {
      name: 'codeMultiple_description',
      bind: 'codeMultiple.description',
      type: FieldType.string,
      label: '代码描述',
      multiple: ',',
    },
    {
      name: 'sex',
      type: FieldType.string,
      label: '性别',
      lookupUrl: '/_api/table/inline/common/code/HR.EMPLOYEE_GENDER',
      lookupCode: 'HR.EMPLOYEE_GENDER',
      required: true,
    },
    {
      name: 'sexMultiple',
      type: FieldType.string,
      label: '性别（多值）',
      lookupUrl: '/_api/table/inline/common/code/HR.EMPLOYEE_GENDER',
      lookupCode: 'HR.EMPLOYEE_GENDER',
      multiple: true,
    },
    {
      name: 'accountMultiple',
      type: FieldType.string,
      bind: 'account.multiple',
      label: '多值拼接',
      lookupUrl: '/_api/table/inline/common/code/HR.EMPLOYEE_GENDER',
      lookupCode: 'HR.EMPLOYEE_GENDER',
      multiple: ',',
    },
    { name: 'account', type: FieldType.object },
    { name: 'enable', type: FieldType.boolean, label: '是否开启', unique: 'uniqueGroup' },
    { name: 'frozen', type: FieldType.boolean, label: '是否冻结', trueValue: 'Y', falseValue: 'N' },
    { name: 'date.startDate', type: FieldType.date, label: '开始日期', defaultValue: new Date() },
    { name: 'date.endDate', type: FieldType.dateTime, label: '结束日期' },
  ],
});

  export default tableInlineDs;